package com.demo.thread.base;

import cn.hutool.core.text.StrBuilder;
import cn.hutool.core.util.StrUtil;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author huangChao
 **/
public class ThreadBase {
    private final static ExecutorService executor = Executors.newCachedThreadPool();

    public static void execute(Invoker run) {
        executor.execute(() -> {
            try {
                run.run();
            } catch (Throwable e) {
                e.printStackTrace();
            }
        });

    }



    public interface Invoker {
        void run() throws Exception;
    }
}
